var express = require("express");
var app = express();
let path = require("path");
const cookieParser = require("cookie-parser");
const session = require("express-session");
const axios = require("axios");
axios.defaults.baseURL ='http://42.194.158.211:8081/';
app.use('/publics', express.static(path.join(__dirname, './publics')))
app.use('/views', express.static(path.join(__dirname, './views')))
app.use("/node_modules/", express.static(path.join(__dirname, "./node_modules/")));
app.engine('html', require('express-art-template'))
app.set('views', path.join(__dirname, './views/'))

app.use(express.json());
app.use(express.urlencoded({ extended: false }));

let template = require("art-template");

/*引入路由 */
let router = require("./routers/front-stage/l-router");
let playRouter = require("./routers/front-stage/l-playRouter");
let routers = require("./routers/back-stage/y-router");
//引入路由
let routers1 = require("./routers/back-stage/upload");
/*李嘉怡 */
let mypersonRouter = require("./routers/front-stage/mypersonRouter");
let alltypeRouter = require("./routers/front-stage/alltypeRouter");
let viprouter = require("./routers/front-stage/vipRouter");
let uploadRouter = require("./routers/front-stage/uploadRouter");
let actorIntroduce = require("./routers/front-stage/actorIntroduceRouter");
let clientRouter = require("./routers/front-stage/clientRouter");
let toplistRouter = require("./routers/front-stage/toplistRouter");
let globalsearchRouter = require("./routers/front-stage/globalsearchRouter");
let paysuccessrouter = require("./routers/front-stage/paysuccessrouter");

// 刘研
let lyrouter = require("./routers/front-stage/ly-router");

//引包
let bodyParser = require("body-parser");

app.use(cookieParser());

/*llll */
app.use(
  session({
    secret: "keyboard cat",
    cookie: { maxAge: 60 * 60 * 1000 * 7 },
    resave: false,
    saveUninitialized: true,
  })
);

/* */

app.use(express.json());
app.use(express.urlencoded({ extended: false }));
// 模块化引用
// let module1 = require(./l-comment)
// module1.foo();
app.use(router);
app.use(playRouter);
app.use(routers);
//使用路由
app.use(routers1);
app.use(mypersonRouter);
app.use(alltypeRouter);
app.use(viprouter);
app.use(uploadRouter);
app.use(actorIntroduce);
app.use(clientRouter);
app.use(globalsearchRouter);
app.use(paysuccessrouter);
app.use(lyrouter);
app.use(toplistRouter);
/*端口号 */
app.listen(3000, function () {
  console.log("App is running...");
});

module.exports = app;
